package com.nuo.jpa;

import java.io.IOException;
import java.io.InputStream;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.hibernate.Session;

public class ManagerFactory {
	
	private static EntityManagerFactory emf = null;
	
	private static void init() {
		emf = Persistence.createEntityManagerFactory("myJPA");

	}
	
	public static EntityManager getEntityManager() {
		if(emf == null){
			init();
		}
		if(emf != null){
			return emf.createEntityManager();
		}else{
			return null;
		}
	}
	
}
